﻿/*
' DotNetNuke® - http://www.dotnetnuke.com
' Copyright (c) 2002-2006
' by Perpetual Motion Interactive Systems Inc. ( http://www.perpetualmotion.ca )
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
' documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 
' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all copies or substantial portions 
' of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
' DEALINGS IN THE SOFTWARE.
 */

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Xml;
using System.Web;
using DotNetNuke;
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Services.Search;

namespace Triax.Modules.Department
{
    /// -----------------------------------------------------------------------------
    ///<summary>
    /// The Controller class for the Department
    /// </summary>
    /// <remarks>
    /// </remarks>
    /// <history>
    /// </history>
    /// -----------------------------------------------------------------------------
    public class DepartmentController : ISearchable, IPortable
    {

        public static string[] datas = new string[] { "ThanhVinh2Center", "ThanhVinh1Center", "BachKhoaCenter", "HuyHoangCenter", "HuyHoangSGCenter" };
        public static string[] datasTitie = new string[] { "Thành vinh 2 ", "Thành vinh 1", "Bách khoa", "Ngọc hà", "Sài gòn" };
    #region Constructors

        public DepartmentController()
        {
        }

    #endregion

    #region Public Methods

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// adds an object to the database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="objDepartment">The DepartmentInfo object</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public void AddDepartment(DepartmentInfo objDepartment)
        {
            if (objDepartment.DepartmentName.Trim() != "")
            {
                DataProvider.Instance().AddDepartment(objDepartment.ModuleId, objDepartment.DepartmentName, objDepartment.Description, objDepartment.ParentId, objDepartment.DepartmentType, objDepartment.Status, objDepartment.CreatedByUser,  objDepartment.DepartmentUserId);
            }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// deletes an object from the database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="ModuleId">The Id of the module</param>
        /// <param name="ItemId">The Id of the item</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public void DeleteDepartment(int ModuleId, int DepartmentId) 
        {
            DataProvider.Instance().DeleteDepartment(ModuleId,DepartmentId);
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// gets an object from the database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="moduleId">The Id of the module</param>
        /// <param name="ItemId">The Id of the item</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public DepartmentInfo GetDepartment(int ModuleId, int DepartmentId)
        {
            return CBO.FillObject<DepartmentInfo>(DataProvider.Instance().GetDepartment(ModuleId, DepartmentId));
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// gets an object from the database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="moduleId">The Id of the module</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public List<DepartmentInfo> GetDepartments(int ModuleId)
        {
            return CBO.FillCollection< DepartmentInfo >(DataProvider.Instance().GetDepartments(ModuleId));
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// saves an object to the database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="objDepartment">The DepartmentInfo object</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public void UpdateDepartment(DepartmentInfo objDepartment)
        {
            if (objDepartment.DepartmentName.Trim() != "")
            {
                DataProvider.Instance().UpdateDepartment(objDepartment.ModuleId, objDepartment.DepartmentId, objDepartment.DepartmentName, objDepartment.Description, objDepartment.ParentId, objDepartment.DepartmentType, objDepartment.Status, objDepartment.UpdatedByUser, objDepartment.DepartmentUserId);
            }
        }

        public List<DepartmentInfo> GetDepartmentsByParent(int ModuleId)
        {
            return CBO.FillCollection<DepartmentInfo>(DataProvider.Instance().GetDepartmentsByParent(ModuleId));
        }

        public List<DepartmentInfo> GetAllDepartmentsByParent(int ModuleId)
        {
            return CBO.FillCollection<DepartmentInfo>(DataProvider.Instance().GetAllDepartmentsByParent(ModuleId));
        }    

        public List<DepartmentInfo> GetDepartmentsByCond(int ModuleId, string Cond, string Sql)
        {
            return CBO.FillCollection<DepartmentInfo>(DataProvider.Instance().GetDepartmentsByCond(ModuleId, Cond, Sql));
        }

        // DepartmentSubject
        public void AddDepartmentSubject(DepartmentSubjectInfo objDepartmentSubject)
        {
            DataProvider.Instance().AddDepartmentSubject(objDepartmentSubject.ModuleId, objDepartmentSubject.DepartmentId, objDepartmentSubject.SubjectId, objDepartmentSubject.Status, objDepartmentSubject.CreatedByUser);
        }

        public DepartmentSubjectInfo GetDepartmentSubject(int ModuleId, int DepartmentSubjectId)
        {
            return CBO.FillObject<DepartmentSubjectInfo>(DataProvider.Instance().GetDepartmentSubject(ModuleId, DepartmentSubjectId));
        }

        public List<DepartmentSubjectInfo> GetDepartmentSubjects(int ModuleId)
        {
            return CBO.FillCollection<DepartmentSubjectInfo>(DataProvider.Instance().GetDepartmentSubjects(ModuleId));
        }

        public void UpdateDepartmentSubject(DepartmentSubjectInfo objDepartmentSubject)
        {
            DataProvider.Instance().UpdateDepartmentSubject(objDepartmentSubject.ModuleId, objDepartmentSubject.DepartmentSubjectId, objDepartmentSubject.DepartmentId, objDepartmentSubject.SubjectId, objDepartmentSubject.Status, objDepartmentSubject.UpdatedByUser);
        }

        public void DeleteDepartmentSubject(int ModuleId, int DepartmentSubjectId)
        {
            DataProvider.Instance().DeleteDepartmentSubject(ModuleId, DepartmentSubjectId);
        }

        public List<DepartmentSubjectInfo> GetDepartmentSubjectsByCond(int ModuleId, string Cond, string Sql)
        {
            return CBO.FillCollection<DepartmentSubjectInfo>(DataProvider.Instance().GetDepartmentSubjectsByCond(ModuleId, Cond, Sql));
        }

        public void DeleteDepartmentSubjectByCond(int ModuleId, string Cond, string Sql)
        {
            DataProvider.Instance().DeleteDepartmentSubjectByCond(ModuleId, Cond, Sql);
        }

        // Dơn vi tập đoàn
        public void AddDonViTapDoan(Triax.Modules.Department.DonViTapDoanInfo obj)
        {
            //  if (obj.DonViTapDoanName.Trim() != "")
            {
                DataProvider.Instance().AddDonViTapDoan(obj.ModuleId,

 obj.code,
 obj.title,
 obj.ParentId,
 obj.Description,
 obj.temp_double1,
 obj.temp_double2,
 obj.temp_string1,
 obj.temp_string2,
 obj.temp_string3,
 obj.temp_int1,
 obj.temp_int2,
 obj.temp_int3,
 obj.CreatedByUser,
 obj.CreatedDate,
 obj.UpdatedByUser,
 obj.UpdatedDate


                 );
            }
        }

        /// -----------------------------------------------------------------------------
        public void DeleteDonViTapDoan(int ModuleId, int DonViTapDoanId)
        {
            DataProvider.Instance().DeleteDonViTapDoan(ModuleId, DonViTapDoanId);
        }

        public DonViTapDoanInfo GetDonViTapDoan(int ModuleId, int DonViTapDoanId)
        {
            return CBO.FillObject<Triax.Modules.Department.DonViTapDoanInfo>(DataProvider.Instance().GetDonViTapDoan(ModuleId, DonViTapDoanId));
        }

        public List<DonViTapDoanInfo> GetDonViTapDoans(int ModuleId)
        {
            return CBO.FillCollection<DonViTapDoanInfo>(DataProvider.Instance().GetDonViTapDoans(ModuleId));
        }




        public void UpdateDonViTapDoan(DonViTapDoanInfo obj)
        {
            //   if (obj.DonViTapDoanName.Trim() != "")
            {
                DataProvider.Instance().UpdateDonViTapDoan(obj.ModuleId,

                obj.id,
obj.code,
obj.title,
obj.ParentId,
obj.Description,
obj.temp_double1,
obj.temp_double2,
obj.temp_string1,
obj.temp_string2,
obj.temp_string3,
obj.temp_int1,
obj.temp_int2,
obj.temp_int3,
obj.CreatedByUser,
obj.CreatedDate,
obj.UpdatedByUser,
obj.UpdatedDate


                );
            }
        }

        public List<DonViTapDoanInfo> GetDonViTapDoansByCond(int ModuleId, string Cond, string Sql)
        {
            return CBO.FillCollection<DonViTapDoanInfo>(DataProvider.Instance().GetDonViTapDoansByCond(ModuleId, Cond, Sql));
        }

        // end don tập đoàn

        // Loại hình đơn vị
        public void AddLoaiHinhDonVi(Triax.Modules.Department.LoaiHinhDonViInfo obj)
        {
            //  if (obj.LoaiHinhDonViName.Trim() != "")
            {
                DataProvider.Instance().AddLoaiHinhDonVi(obj.ModuleId,

 obj.code,
 obj.title,
 obj.ParentId,
 obj.Description,
 obj.temp_double1,
 obj.temp_double2,
 obj.temp_string1,
 obj.temp_string2,
 obj.temp_string3,
 obj.temp_int1,
 obj.temp_int2,
 obj.temp_int3,
 obj.CreatedByUser,
 obj.CreatedDate,
 obj.UpdatedByUser,
 obj.UpdatedDate


                 );
            }
        }

        /// -----------------------------------------------------------------------------
        public void DeleteLoaiHinhDonVi(int ModuleId, int LoaiHinhDonViId)
        {
            DataProvider.Instance().DeleteLoaiHinhDonVi(ModuleId, LoaiHinhDonViId);
        }

        public LoaiHinhDonViInfo GetLoaiHinhDonVi(int ModuleId, int LoaiHinhDonViId)
        {
            return CBO.FillObject<Triax.Modules.Department.LoaiHinhDonViInfo>(DataProvider.Instance().GetLoaiHinhDonVi(ModuleId, LoaiHinhDonViId));
        }

        public List<LoaiHinhDonViInfo> GetLoaiHinhDonVis(int ModuleId)
        {
            return CBO.FillCollection<LoaiHinhDonViInfo>(DataProvider.Instance().GetLoaiHinhDonVis(ModuleId));
        }




        public void UpdateLoaiHinhDonVi(LoaiHinhDonViInfo obj)
        {
            //   if (obj.LoaiHinhDonViName.Trim() != "")
            {
                DataProvider.Instance().UpdateLoaiHinhDonVi(obj.ModuleId,

                obj.id,
obj.code,
obj.title,
obj.ParentId,
obj.Description,
obj.temp_double1,
obj.temp_double2,
obj.temp_string1,
obj.temp_string2,
obj.temp_string3,
obj.temp_int1,
obj.temp_int2,
obj.temp_int3,
obj.CreatedByUser,
obj.CreatedDate,
obj.UpdatedByUser,
obj.UpdatedDate


                );
            }
        }

        public List<LoaiHinhDonViInfo> GetLoaiHinhDonVisByCond(int ModuleId, string Cond, string Sql)
        {
            return CBO.FillCollection<LoaiHinhDonViInfo>(DataProvider.Instance().GetLoaiHinhDonVisByCond(ModuleId, Cond, Sql));
        }

        // End Loại hình đơn vị

        // Nhóm vụ việc
        public void AddNhomVuViec(Triax.Modules.Department.NhomVuViecInfo obj)
        {
            //  if (obj.NhomVuViecName.Trim() != "")
            {
                DataProvider.Instance().AddNhomVuViec(obj.ModuleId,

 obj.code,
 obj.title,
 obj.ParentId,
 obj.Description,
 obj.temp_double1,
 obj.temp_double2,
 obj.temp_string1,
 obj.temp_string2,
 obj.temp_string3,
 obj.temp_int1,
 obj.temp_int2,
 obj.temp_int3,
 obj.CreatedByUser,
 obj.CreatedDate,
 obj.UpdatedByUser,
 obj.UpdatedDate


                 );
            }
        }

        /// -----------------------------------------------------------------------------
        public void DeleteNhomVuViec(int ModuleId, int NhomVuViecId)
        {
            DataProvider.Instance().DeleteNhomVuViec(ModuleId, NhomVuViecId);
        }

        public NhomVuViecInfo GetNhomVuViec(int ModuleId, int NhomVuViecId)
        {
            return CBO.FillObject<Triax.Modules.Department.NhomVuViecInfo>(DataProvider.Instance().GetNhomVuViec(ModuleId, NhomVuViecId));
        }

        public List<NhomVuViecInfo> GetNhomVuViecs(int ModuleId)
        {
            return CBO.FillCollection<NhomVuViecInfo>(DataProvider.Instance().GetNhomVuViecs(ModuleId));
        }




        public void UpdateNhomVuViec(NhomVuViecInfo obj)
        {
            //   if (obj.NhomVuViecName.Trim() != "")
            {
                DataProvider.Instance().UpdateNhomVuViec(obj.ModuleId,

                obj.id,
obj.code,
obj.title,
obj.ParentId,
obj.Description,
obj.temp_double1,
obj.temp_double2,
obj.temp_string1,
obj.temp_string2,
obj.temp_string3,
obj.temp_int1,
obj.temp_int2,
obj.temp_int3,
obj.CreatedByUser,
obj.CreatedDate,
obj.UpdatedByUser,
obj.UpdatedDate


                );
            }
        }

        public List<NhomVuViecInfo> GetNhomVuViecsByCond(int ModuleId, string Cond, string Sql)
        {
            return CBO.FillCollection<NhomVuViecInfo>(DataProvider.Instance().GetNhomVuViecsByCond(ModuleId, Cond, Sql));
        }

        // End Nhóm vụ việc
        // Xử lý vụ việc
        public void AddXuLyVuViec(Triax.Modules.Department.XuLyVuViecInfo obj)
        {
            //  if (obj.XuLyVuViecName.Trim() != "")
            {
                DataProvider.Instance().AddXuLyVuViec(obj.ModuleId,

 obj.code,
 obj.title,
 obj.Thoigian,
 obj.ParentId,
 obj.Description,
 obj.temp_double1,
 obj.temp_double2,
 obj.temp_string1,
 obj.temp_string2,
 obj.temp_string3,
 obj.temp_int1,
 obj.temp_int2,
 obj.temp_int3,
 obj.CreatedByUser,
 obj.CreatedDate,
 obj.UpdatedByUser,
 obj.UpdatedDate


                 );
            }
        }

        /// -----------------------------------------------------------------------------
        public void DeleteXuLyVuViec(int ModuleId, int XuLyVuViecId)
        {
            DataProvider.Instance().DeleteXuLyVuViec(ModuleId, XuLyVuViecId);
        }

        public XuLyVuViecInfo GetXuLyVuViec(int ModuleId, int XuLyVuViecId)
        {
            return CBO.FillObject<Triax.Modules.Department.XuLyVuViecInfo>(DataProvider.Instance().GetXuLyVuViec(ModuleId, XuLyVuViecId));
        }

        public List<XuLyVuViecInfo> GetXuLyVuViecs(int ModuleId)
        {
            return CBO.FillCollection<XuLyVuViecInfo>(DataProvider.Instance().GetXuLyVuViecs(ModuleId));
        }




        public void UpdateXuLyVuViec(XuLyVuViecInfo obj)
        {
            //   if (obj.XuLyVuViecName.Trim() != "")
            {
                DataProvider.Instance().UpdateXuLyVuViec(obj.ModuleId,

                obj.id,
obj.code,
obj.title,
obj.Thoigian,
obj.ParentId,
obj.Description,
obj.temp_double1,
obj.temp_double2,
obj.temp_string1,
obj.temp_string2,
obj.temp_string3,
obj.temp_int1,
obj.temp_int2,
obj.temp_int3,
obj.CreatedByUser,
obj.CreatedDate,
obj.UpdatedByUser,
obj.UpdatedDate


                );
            }
        }

        public List<XuLyVuViecInfo> GetXuLyVuViecsByCond(int ModuleId, string Cond, string Sql)
        {
            return CBO.FillCollection<XuLyVuViecInfo>(DataProvider.Instance().GetXuLyVuViecsByCond(ModuleId, Cond, Sql));
        }

        // End Xử lý vụ việc

        // Kết hợp xử lý
        public void AddKethopXuLy(Triax.Modules.Department.KetHopXuLyInfo obj)
        {
            //  if (obj.KethopXuLyName.Trim() != "")
            {
                DataProvider.Instance().AddKetHopXuLy(obj.ModuleId,

 obj.code,
 obj.title,
 obj.Thoigian,
 obj.ParentId,
 obj.Description,
 obj.temp_double1,
 obj.temp_double2,
 obj.temp_string1,
 obj.temp_string2,
 obj.temp_string3,
 obj.temp_int1,
 obj.temp_int2,
 obj.temp_int3,
 obj.CreatedByUser,
 obj.CreatedDate,
 obj.UpdatedByUser,
 obj.UpdatedDate


                 );
            }
        }

        /// -----------------------------------------------------------------------------
        public void DeleteKethopXuLy(int ModuleId, int KethopXuLyId)
        {
            DataProvider.Instance().DeleteKetHopXuLy(ModuleId, KethopXuLyId);
        }

        public KetHopXuLyInfo GetKethopXuLy(int ModuleId, int KethopXuLyId)
        {
            return CBO.FillObject<Triax.Modules.Department.KetHopXuLyInfo>(DataProvider.Instance().GetKetHopXuLy(ModuleId, KethopXuLyId));
        }

        public List<KetHopXuLyInfo> GetKethopXuLys(int ModuleId)
        {
            return CBO.FillCollection<KetHopXuLyInfo>(DataProvider.Instance().GetKetHopXuLys(ModuleId));
        }




        public void UpdateKethopXuLy(KetHopXuLyInfo obj)
        {
            //   if (obj.KethopXuLyName.Trim() != "")
            {
                DataProvider.Instance().UpdateKetHopXuLy(obj.ModuleId,

                obj.id,
obj.code,
obj.title,
obj.Thoigian,
obj.ParentId,
obj.Description,
obj.temp_double1,
obj.temp_double2,
obj.temp_string1,
obj.temp_string2,
obj.temp_string3,
obj.temp_int1,
obj.temp_int2,
obj.temp_int3,
obj.CreatedByUser,
obj.CreatedDate,
obj.UpdatedByUser,
obj.UpdatedDate


                );
            }
        }

        public List<KetHopXuLyInfo> GetKethopXuLysByCond(int ModuleId, string Cond, string Sql)
        {
            return CBO.FillCollection<KetHopXuLyInfo>(DataProvider.Instance().GetKetHopXuLysByCond(ModuleId, Cond, Sql));
        }

        // End kết hợp xử lý
        // Loại vụ việc
        public void AddLoaiVuViec(Triax.Modules.Department.LoaiVuViecInfo obj)
        {
            //  if (obj.LoaiVuViecName.Trim() != "")
            {
                DataProvider.Instance().AddLoaiVuViec(obj.ModuleId,

 obj.code,
 obj.title,
 obj.ParentId,
 obj.Description,
 obj.temp_double1,
 obj.temp_double2,
 obj.temp_string1,
 obj.temp_string2,
 obj.temp_string3,
 obj.temp_int1,
 obj.temp_int2,
 obj.temp_int3,
 obj.CreatedByUser,
 obj.CreatedDate,
 obj.UpdatedByUser,
 obj.UpdatedDate


                 );
            }
        }

        /// -----------------------------------------------------------------------------
        public void DeleteLoaiVuViec(int ModuleId, int LoaiVuViecId)
        {
            DataProvider.Instance().DeleteLoaiVuViec(ModuleId, LoaiVuViecId);
        }

        public LoaiVuViecInfo GetLoaiVuViec(int ModuleId, int LoaiVuViecId)
        {
            return CBO.FillObject<Triax.Modules.Department.LoaiVuViecInfo>(DataProvider.Instance().GetLoaiVuViec(ModuleId, LoaiVuViecId));
        }

        public List<LoaiVuViecInfo> GetLoaiVuViecs(int ModuleId)
        {
            return CBO.FillCollection<LoaiVuViecInfo>(DataProvider.Instance().GetLoaiVuViecs(ModuleId));
        }




        public void UpdateLoaiVuViec(LoaiVuViecInfo obj)
        {
            //   if (obj.LoaiVuViecName.Trim() != "")
            {
                DataProvider.Instance().UpdateLoaiVuViec(obj.ModuleId,

                obj.id,
obj.code,
obj.title,
obj.ParentId,
obj.Description,
obj.temp_double1,
obj.temp_double2,
obj.temp_string1,
obj.temp_string2,
obj.temp_string3,
obj.temp_int1,
obj.temp_int2,
obj.temp_int3,
obj.CreatedByUser,
obj.CreatedDate,
obj.UpdatedByUser,
obj.UpdatedDate


                );
            }
        }

        public List<LoaiVuViecInfo> GetLoaiVuViecsByCond(int ModuleId, string Cond, string Sql)
        {
            return CBO.FillCollection<LoaiVuViecInfo>(DataProvider.Instance().GetLoaiVuViecsByCond(ModuleId, Cond, Sql));
        }

        // End Loại vụ việc

        // Vụ việc
        public void AddVuViec(Triax.Modules.Department.VuViecInfo obj)
        {
            //  if (obj.VuViecName.Trim() != "")
            {
                DataProvider.Instance().AddVuViec(obj.ModuleId,


obj.Quy,
obj.Nam,
obj.Tuan,
obj.Stt,
obj.loaivuviec,
obj.tenCN,
obj.tongCT,
obj.ngayBaoCao,
obj.tomTatNoiDung,
obj.Chet_SQ,
obj.chet_QNCN,
obj.chet_CNVQP,
obj.chet_HDLD,
obj.chet_CTV,
obj.chet_Dan,
obj.biThuong_SQ,
obj.biThuong_QNCN,
obj.biThuong_CNVQP,
obj.biThuong_HDLD,
obj.biThuong_HDDV,
obj.biThuong_CTV,
obj.biThuong_CTV_Khac,
obj.biThuong_Dan,
obj.taiChinh,
obj.taiSan_otoViettel,
obj.taiSan_otoDanSu,
obj.taiSan_Moto,
obj.taiSan_Khac,
obj.thietHai_hangHoa,
obj.thietHai_MangLuoi_BTS,
obj.thietHai_MangLuoi_Phido,
obj.thietHai_MangLuoi_Acqui,
obj.thietHai_MangLuoi_TiepDia,
obj.thietHai_MangLuoi_Cap,
obj.TongThietHai,
obj.NguyenNhan_chuQuan,
obj.NguyenNhan_khacQuan,
obj.loi_quanNhan_SQ,
obj.loi_quanNhan_QNCN,
obj.loi_quanNhan_CSVQP,
obj.loi_quanNhan_HDLD,
obj.loi_quanNhan_CTV,
obj.loi_dan,
obj.DangVien,
obj.DoanVien,
obj.TInhCHat,
obj.baocao_TapDoan,
obj.baocao_CucDTHS,
obj.baocao_TUxuLy,
obj.KQ_Xulybandau,
obj.KQ_Tien,
obj.KQ_HinhThucKyLuat,
obj.KQ_Tamgiam,
obj.KQ_HinhPhat,
obj.CanBoTheodoi,
obj.otherText1,
obj.otherText2,
obj.otherText3,
obj.otherText4,
obj.otherText5,
obj.otherText6,
obj.otherText7,
obj.otherText8,
obj.otherInt1,
obj.otherInt2,
obj.otherInt3,
obj.otherInt4,
obj.otherInt5,
obj.otherInt6,
obj.otherInt7,
obj.otherInt8,
obj.otherDatetime1,
obj.otherDatetime2,
obj.otherDatetime3,
obj.otherDatetime4,
obj.otherDatetime5,
obj.otherDatetime6,
obj.otherDatetime7,
obj.otherDatetime8,

 obj.CreatedByUser,
 obj.CreatedDate,
 obj.UpdatedByUser,
 obj.UpdatedDate


                 );
            }
        }

        /// -----------------------------------------------------------------------------
        public void DeleteVuViec(int ModuleId, int VuViecId)
        {
            DataProvider.Instance().DeleteVuViec(ModuleId, VuViecId);
        }

        public VuViecInfo GetVuViec(int ModuleId, int VuViecId)
        {
            return CBO.FillObject<Triax.Modules.Department.VuViecInfo>(DataProvider.Instance().GetVuViec(ModuleId, VuViecId));
        }

        public List<VuViecInfo> GetVuViecs(int ModuleId)
        {
            return CBO.FillCollection<VuViecInfo>(DataProvider.Instance().GetVuViecs(ModuleId));
        }




        public void UpdateVuViec(VuViecInfo obj)
        {
            //   if (obj.VuViecName.Trim() != "")
            {
                DataProvider.Instance().UpdateVuViec(obj.ModuleId,

            obj.id,
obj.Quy,
obj.Nam,
obj.Tuan,
obj.Stt,
obj.loaivuviec,
obj.tenCN,
obj.tongCT,
obj.ngayBaoCao,
obj.tomTatNoiDung,
obj.Chet_SQ,
obj.chet_QNCN,
obj.chet_CNVQP,
obj.chet_HDLD,
obj.chet_CTV,
obj.chet_Dan,
obj.biThuong_SQ,
obj.biThuong_QNCN,
obj.biThuong_CNVQP,
obj.biThuong_HDLD,
obj.biThuong_HDDV,
obj.biThuong_CTV,
obj.biThuong_CTV_Khac,
obj.biThuong_Dan,
obj.taiChinh,
obj.taiSan_otoViettel,
obj.taiSan_otoDanSu,
obj.taiSan_Moto,
obj.taiSan_Khac,
obj.thietHai_hangHoa,
obj.thietHai_MangLuoi_BTS,
obj.thietHai_MangLuoi_Phido,
obj.thietHai_MangLuoi_Acqui,
obj.thietHai_MangLuoi_TiepDia,
obj.thietHai_MangLuoi_Cap,
obj.TongThietHai,
obj.NguyenNhan_chuQuan,
obj.NguyenNhan_khacQuan,
obj.loi_quanNhan_SQ,
obj.loi_quanNhan_QNCN,
obj.loi_quanNhan_CSVQP,
obj.loi_quanNhan_HDLD,
obj.loi_quanNhan_CTV,
obj.loi_dan,
obj.DangVien,
obj.DoanVien,
obj.TInhCHat,
obj.baocao_TapDoan,
obj.baocao_CucDTHS,
obj.baocao_TUxuLy,
obj.KQ_Xulybandau,
obj.KQ_Tien,
obj.KQ_HinhThucKyLuat,
obj.KQ_Tamgiam,
obj.KQ_HinhPhat,
obj.CanBoTheodoi,
obj.otherText1,
obj.otherText2,
obj.otherText3,
obj.otherText4,
obj.otherText5,
obj.otherText6,
obj.otherText7,
obj.otherText8,
obj.otherInt1,
obj.otherInt2,
obj.otherInt3,
obj.otherInt4,
obj.otherInt5,
obj.otherInt6,
obj.otherInt7,
obj.otherInt8,
obj.otherDatetime1,
obj.otherDatetime2,
obj.otherDatetime3,
obj.otherDatetime4,
obj.otherDatetime5,
obj.otherDatetime6,
obj.otherDatetime7,
obj.otherDatetime8,

obj.CreatedByUser,
obj.CreatedDate,
obj.UpdatedByUser,
obj.UpdatedDate


                );
            }
        }

        public List<VuViecInfo> GetVuViecsByCond(int ModuleId, string Cond, string Sql)
        {
            return CBO.FillCollection<VuViecInfo>(DataProvider.Instance().GetVuViecsByCond(ModuleId, Cond, Sql));
        }

        // end vụ việc

        // Kết hợp xử lý
        public void AddKetHopXuLy(Triax.Modules.Department.KetHopXuLyInfo obj)
        {
            //  if (obj.KetHopXuLyName.Trim() != "")
            {
                DataProvider.Instance().AddKetHopXuLy(obj.ModuleId,

 obj.code,
 obj.title,
 obj.Thoigian,
 obj.ParentId,
 obj.Description,
 obj.temp_double1,
 obj.temp_double2,
 obj.temp_string1,
 obj.temp_string2,
 obj.temp_string3,
 obj.temp_int1,
 obj.temp_int2,
 obj.temp_int3,
 obj.CreatedByUser,
 obj.CreatedDate,
 obj.UpdatedByUser,
 obj.UpdatedDate


                 );
            }
        }

        /// -----------------------------------------------------------------------------
        public void DeleteKetHopXuLy(int ModuleId, int KetHopXuLyId)
        {
            DataProvider.Instance().DeleteKetHopXuLy(ModuleId, KetHopXuLyId);
        }

        public KetHopXuLyInfo GetKetHopXuLy(int ModuleId, int KetHopXuLyId)
        {
            return CBO.FillObject<Triax.Modules.Department.KetHopXuLyInfo>(DataProvider.Instance().GetKetHopXuLy(ModuleId, KetHopXuLyId));
        }

        public List<KetHopXuLyInfo> GetKetHopXuLys(int ModuleId)
        {
            return CBO.FillCollection<KetHopXuLyInfo>(DataProvider.Instance().GetKetHopXuLys(ModuleId));
        }




        public void UpdateKetHopXuLy(KetHopXuLyInfo obj)
        {
            //   if (obj.KetHopXuLyName.Trim() != "")
            {
                DataProvider.Instance().UpdateKetHopXuLy(obj.ModuleId,

                obj.id,
obj.code,
obj.title,
obj.Thoigian,
obj.ParentId,
obj.Description,
obj.temp_double1,
obj.temp_double2,
obj.temp_string1,
obj.temp_string2,
obj.temp_string3,
obj.temp_int1,
obj.temp_int2,
obj.temp_int3,
obj.CreatedByUser,
obj.CreatedDate,
obj.UpdatedByUser,
obj.UpdatedDate


                );
            }
        }

        public List<KetHopXuLyInfo> GetKetHopXuLysByCond(int ModuleId, string Cond, string Sql)
        {
            return CBO.FillCollection<KetHopXuLyInfo>(DataProvider.Instance().GetKetHopXuLysByCond(ModuleId, Cond, Sql));
        }

        // End kết hợp xử lý
    #endregion

    #region Optional Interfaces

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetSearchItems implements the ISearchable Interface
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo)
        {
            SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection();
            List<DepartmentInfo> colDepartments  = GetDepartments(ModInfo.ModuleID);

            foreach (DepartmentInfo objDepartment in colDepartments)
            {
                if(objDepartment != null)
                {
                    SearchItemInfo SearchItem = new SearchItemInfo(ModInfo.ModuleTitle, objDepartment.DepartmentName, objDepartment.CreatedByUser, objDepartment.CreatedDate, ModInfo.ModuleID, objDepartment.DepartmentId.ToString(), objDepartment.DepartmentName, "ItemId=" + objDepartment.DepartmentId.ToString());
                    SearchItemCollection.Add(SearchItem);
                }
            }

            return SearchItemCollection;
        }


        /// -----------------------------------------------------------------------------
        /// <summary>
        /// ExportModule implements the IPortable ExportModule Interface
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="ModuleID">The Id of the module to be exported</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public string ExportModule(int ModuleID)
        {
            string strXML = "";
            List<DepartmentInfo> colDepartments  = GetDepartments(ModuleID);

            if (colDepartments.Count != 0)
            {
                strXML += "<Departments>";
                foreach (DepartmentInfo objDepartment in colDepartments)
                {
                    strXML += "<Department>";
                    strXML += "<content>" + XmlUtils.XMLEncode(objDepartment.DepartmentName) + "</content>";
                    strXML += "</Department>";
                }
                strXML += "</Departments>";
            }

            return strXML;
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// ImportModule implements the IPortable ImportModule Interface
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="ModuleID">The Id of the module to be imported</param>
        /// <param name="Content">The content to be imported</param>
        /// <param name="Version">The version of the module to be imported</param>
        /// <param name="UserId">The Id of the user performing the import</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public void ImportModule(int ModuleID, string Content, string Version, int UserId)
        {
            XmlNode xmlDepartments = Globals.GetContent(Content, "Departments");

            foreach (XmlNode xmlDepartment in xmlDepartments.SelectNodes("Department"))
            {
                DepartmentInfo objDepartment = new DepartmentInfo();

                objDepartment.ModuleId = ModuleID;
                objDepartment.DepartmentName = xmlDepartment.SelectSingleNode("content").InnerText;
                objDepartment.CreatedByUser = UserId;
                AddDepartment(objDepartment);
            }

}

    #endregion

    }
}

